﻿/*
=============================================================================
Author:魏宝辉通过CodeSmithe生成
CreatedTime:2012-12-12
Description:SoftDownload三层结构数据访问层
=============================================================================
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using PWMIS.DataMap.Entity;
using FTchina.Models;//引入模型层
namespace FTchina.DAL
{
	public static partial class SoftDownloadService
	{
		 
	 
			
		public static int DeleteSoftDownloadById(long id)	
		{     
            SoftDownload softDownload = new SoftDownload();
            softDownload.Id = id;
            EntityQuery<SoftDownload> query = new EntityQuery<SoftDownload>(softDownload);
             return query.Delete(softDownload);
		}	
        
          //以标识列获得对象
        public static SoftDownload GetSoftDownloadById(long  id)
        {
            SoftDownload softDownload = new SoftDownload();
            softDownload.Id = id;
            EntityQuery<SoftDownload> query = new EntityQuery<SoftDownload>(softDownload);
            query.FillEntity(softDownload);
            return softDownload;
        }
		
	 
	 
       
        
        
        
		 
		 
		 public static int AddOrUpdateSoftDownload(SoftDownload softDownload)
        {
            SoftDownload _softDownload = new SoftDownload();

            EntityQuery<SoftDownload> query = new EntityQuery<SoftDownload>(_softDownload);
           _softDownload= softDownload;
           int i=(softDownload.Id==0)?
                 query.Insert(_softDownload): query.Update(_softDownload);
            return i;
        }
		
		 
	}
}

